//
//  AppConfig.m
//  Kfangchan
//
//  Created by liran on 14/11/5.
//  Copyright (c) 2014年 Beijing Renjuren Network Technology Co., Ltd. All rights reserved.
//

#import "AppConfig.h"

@implementation AppConfig

static NSString *AGENT_KEY = @"APP_AGENT_INFO";

#pragma mark 获取用户信息
+(NSDictionary *)getAgent {
    NSDictionary *agent = [[NSUserDefaults standardUserDefaults] objectForKey:AGENT_KEY];
    return agent == nil ? [NSDictionary dictionary] : agent;
}

#pragma mark 设置用户信息
+ (void)setAgent:(NSDictionary *)agent {
    [[NSUserDefaults standardUserDefaults] setObject:agent forKey:AGENT_KEY];
    [[NSUserDefaults standardUserDefaults] synchronize];
}


#pragma mark 清空用户信息
+ (void)removeAgent {
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:AGENT_KEY];
}

+ (void)setAPPUserToken:(NSString *)token
{
    NSString *kName =@"APP_USER_TOKEN";
    [[NSUserDefaults standardUserDefaults] setObject:token forKey:kName];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

+ (NSString *)getAPPUserToken {
    NSString *kName =@"APP_USER_TOKEN";
    
    NSString *token = [[NSUserDefaults standardUserDefaults] objectForKey:kName];
    return StringIsNullOrEmpty(token) ? @"" : token;
}


@end
